package com.help10000.rms.ui.adapter

import android.content.Context
import android.view.View
import com.amir.common.api.ApiContents
import com.amir.common.beans.Cmpy
import com.amir.common.holder.CommonViewHolder
import com.amir.common.mvp.base.BaseRecyclerAdapter
import com.amir.common.utils.ImageHelper
import com.help10000.rms.R

class CompanyAdapter(
    context: Context?,
    dataList: List<Cmpy?>?,
    layoutId: Int
) : BaseRecyclerAdapter<Cmpy?>(context, dataList, layoutId) {
    override fun bindData(holder: CommonViewHolder?, data: Cmpy?, position: Int) {
        holder?.setText(R.id.tv_name, data?.CmpyName!!)
        ImageHelper.displayImage(mContext,"${ApiContents.ImageUrl}${data?.Logo}", holder?.getView(R.id.iv_logo))
        holder?.setOnClickListener(
            R.id.ll_root, { v: View? ->
                if (mOnItemClickListener != null) {
                    mOnItemClickListener.onItem(position)
                }
            }
        )
    }
}